In [1]:
import pandas as pd
import plotly.express as px
import plotly.io as pio
from dateutil import parser
from dateutil.relativedelta import *
In [2]:
covidData = pd.read_csv("owid_covid-19-data_latest_covid-19-world-cases-deaths-testing.csv")
covidData = covidData[['iso_code','continent','location','total_cases','total_deaths','new_cases', 'new_deaths','life_expectancy','median_age','date']]
In [3]:
covidData = covidData.bfill() #Next Observation Carried Backward
display(covidData)
iso_code continent location total_cases total_deaths new_cases new_deaths life_expectancy median_age date
0 AFG Asia Afghanistan 5.0 1.0 5.0 1.0 64.83 18.6 2020-02-24
1 AFG Asia Afghanistan 5.0 1.0 0.0 1.0 64.83 18.6 2020-02-25
2 AFG Asia Afghanistan 5.0 1.0 0.0 1.0 64.83 18.6 2020-02-26
3 AFG Asia Afghanistan 5.0 1.0 0.0 1.0 64.83 18.6 2020-02-27
4 AFG Asia Afghanistan 5.0 1.0 0.0 1.0 64.83 18.6 2020-02-28
... ... ... ... ... ... ... ... ... ... ...
201494 ZWE Africa Zimbabwe 255953.0 5565.0 14.0 1.0 61.49 19.6 2022-07-11
201495 ZWE Africa Zimbabwe 255981.0 5565.0 28.0 0.0 61.49 19.6 2022-07-12
201496 ZWE Africa Zimbabwe 255981.0 5565.0 0.0 0.0 61.49 19.6 2022-07-13
201497 ZWE Africa Zimbabwe 256047.0 5566.0 66.0 1.0 61.49 19.6 2022-07-14
201498 ZWE Africa Zimbabwe 256083.0 5566.0 36.0 0.0 61.49 19.6 2022-07-15

201499 rows × 10 columns

In [4]:
fig=px.line(covidData,x = 'date',
y='new_deaths',color='continent',
title='New covid deaths of each continent')
fig.show()
In [5]:
fig=px.line(covidData,x = 'date',
y='new_cases',color='continent',
title='New covid cases of each continent')
fig.show()
In [6]:
fig=px.pie(covidData,values='total_cases',names='continent',title='Total cases based on continet')
fig.show()
In [7]:
fig=px.pie(covidData,values='total_deaths',names='continent',title='Total deaths based on  continet')
fig.show()
In [8]:
country_info = covidData[covidData['location']=='India']
fig=px.line(country_info,x ='date',
y='new_cases',
title='New covid cases of India')
fig.show()
In [9]:
country_info = covidData[covidData['location']=='United States']
fig=px.line(country_info,x ='date',
y='new_cases',
title='New covid cases of United States')
fig.show()